home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / arrhand / form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-07-21  |  3.8 KB  |  140 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Form1"
  4.    ClientHeight    =   3465
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   6600
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   3465
  10.    ScaleWidth      =   6600
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton Command2 
  13.       Caption         =   "VB-code"
  14.       Height          =   495
  15.       Left            =   480
  16.       TabIndex        =   1
  17.       Top             =   840
  18.       Width           =   1215
  19.    End
  20.    Begin VB.CommandButton Command1 
  21.       Caption         =   "C++-server"
  22.       Height          =   495
  23.       Left            =   480
  24.       TabIndex        =   0
  25.       Top             =   1440
  26.       Width           =   1215
  27.    End
  28.    Begin VB.Label txtTemp 
  29.       Caption         =   "Label1"
  30.       Height          =   495
  31.       Left            =   1920
  32.       TabIndex        =   5
  33.       Top             =   2640
  34.       Width           =   1215
  35.    End
  36.    Begin VB.Label txtTid 
  37.       Caption         =   "Label1"
  38.       Height          =   495
  39.       Left            =   1920
  40.       TabIndex        =   4
  41.       Top             =   2160
  42.       Width           =   1215
  43.    End
  44.    Begin VB.Label txtTidC 
  45.       Caption         =   "Time:"
  46.       Height          =   255
  47.       Left            =   480
  48.       TabIndex        =   3
  49.       Top             =   2160
  50.       Width           =   1215
  51.    End
  52.    Begin VB.Label Label3 
  53.       Caption         =   "Rebase an array with 20*1000 fields from base 0 to 1 ( ADO Recordset for instance )"
  54.       Height          =   495
  55.       Left            =   120
  56.       TabIndex        =   2
  57.       Top             =   120
  58.       Width           =   6255
  59.    End
  60. Attribute VB_Name = "Form1"
  61. Attribute VB_GlobalNameSpace = False
  62. Attribute VB_Creatable = False
  63. Attribute VB_PredeclaredId = True
  64. Attribute VB_Exposed = False
  65. Option Explicit
  66. Option Base 1
  67. Private Sub Command2_Click()
  68. Dim sStart As Single
  69. Dim sStop As Single
  70. Dim vData As Variant
  71. vData = GetData
  72. If LBound(vData, 1) <> 0 Then
  73.   MsgBox "FEL"
  74. End If
  75. If LBound(vData, 2) <> 0 Then
  76.   MsgBox "FEL"
  77. End If
  78. sStart = Timer
  79. vData = Rebase(vData)
  80. sStop = Timer
  81. txtTid.Caption = CStr(sStop - sStart)
  82. txtTemp.Caption = "Nr of rows:" & UBound(vData, 1) & " Columns:" & UBound(vData, 2)
  83. If LBound(vData, 1) <> 1 Then
  84.   MsgBox "FEL"
  85. End If
  86. If LBound(vData, 2) <> 1 Then
  87.   MsgBox "FEL"
  88. End If
  89. End Sub
  90. Private Sub Command1_Click()
  91. Dim sStart As Single
  92. Dim sStop As Single
  93. Dim vData As Variant
  94. Dim oChanger As ARRAYHAND_SRVLib.ArrayHandler
  95. vData = GetData
  96. If LBound(vData, 1) <> 0 Then
  97.   MsgBox "FEL"
  98. End If
  99. If LBound(vData, 2) <> 0 Then
  100.   MsgBox "FEL"
  101. End If
  102. sStart = Timer
  103. Set oChanger = New ARRAYHAND_SRVLib.ArrayHandler
  104. oChanger.BaseZeroToOne vData
  105. sStop = Timer
  106. txtTid.Caption = CStr(sStop - sStart)
  107. txtTemp.Caption = "Nr of rows:" & UBound(vData, 1) & " Columns:" & UBound(vData, 2)
  108. If LBound(vData, 1) <> 1 Then
  109.   MsgBox "FEL"
  110. End If
  111. If LBound(vData, 2) <> 1 Then
  112.   MsgBox "FEL"
  113. End If
  114. End Sub
  115. Function GetData() As Variant
  116. Dim nRow As Integer
  117. Dim nCol As Integer
  118. Dim vData(0 To 19, 0 To 999) As Variant
  119. For nRow = 0 To 19
  120.     For nCol = 0 To 999
  121.         vData(nRow, nCol) = CStr(nRow) & ";" & CStr(nCol)
  122.     Next
  123. GetData = vData
  124. End Function
  125. Public Function Rebase(vArray As Variant) As Variant
  126. Dim vRetArray() As Variant
  127. Dim nRow As Integer
  128. Dim nCol As Integer
  129. Dim nRows As Integer
  130. Dim nCols As Integer
  131. nRows = UBound(vArray, 1)
  132. nCols = UBound(vArray, 2)
  133. ReDim vRetArray(1 To nRows + 1, 1 To nCols + 1)
  134. For nRow = 0 To nRows
  135.     For nCol = 0 To nCols
  136.         vRetArray(nRow + 1, nCol + 1) = vArray(nRow, nCol)
  137.     Next
  138. Rebase = vRetArray
  139. End Function
  140.